<template>
	<view>
		<navSearchBar title="我的活动单"></navSearchBar>
		<view class="list">
			<view class="list-item" @click="toDetail(active.client_id)" v-if="showInfo.activity_status">
				<view class="title flex-col-between" >
					<text class="title-name" v-if="active.client">{{active.client.name}}</text>
					<text class="title-name" v-else>暂无内容</text>
					<text class="title-time">{{active.create_time}}</text>
				</view>
				<view class="desc flex-col-between" >
					<text>{{active.title}}</text>
					<image src="/static/personal/right.png" mode=""></image>
				</view>
			</view>
			<view class="list-item" v-if="showInfo.question_status" @click="toQuestion">
				<text class="title-name  flex-row-center">调查问卷</text>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				active: {},
				showInfo: {}
			};
		},
		filters:{
			empty(value){
				
				if(value){
					return value
				} else {
					return '暂无内容'
				}
			}
			
		},
		onLoad() {
			// let id = this.$Route.query.id
			this.getActive()
		},
		onShow(){
			//调差问卷退出在调一次状态
			this.hasShowActive();
		},
		methods: {
			async getActive() {
				let res = await this.$api.activeC()
				this.active = res.data.data||{client:''};
				console.log(this.active, "active")
			},
			async hasShowActive() {
				let res = await this.$api.showActiveC()
				this.showInfo = res.data.data
				console.log(this.showInfo, "showInfo")
			},
			toDetail(id){
				console.log(id,"id")
				if(this.active.title){
					this.$Router.push({name:"commonActiveDetail",query:{id}})
				}
				
			},
			toQuestion() {
				this.$Router.push({
					name: "commonActiveQuestion",
					query: {
						id: this.active.client_id
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.list {
		padding: 30rpx 40rpx 30rpx 20rpx;

		.list-item {
			width: 100%;
			height: 148rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			border-bottom: 2rpx solid #EFEFEF;

			.title {
				margin-bottom: 30rpx;
			}

			.title-name {
				line-height: 32rpx;
				font-size: 32rpx;
				font-weight: $Semibold;
				color: #525252;
			}

			.title-time {
				line-height: 24rpx;
				font-size: 24rpx;
				color: #6F6F6F;
			}

			.desc {
				text {
					font-size: $text-size;
					color: #6F6F6F;
				}

				image {
					width: 10rpx;
					height: 20rpx;
				}
			}

		}
	}
</style>